<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // 1
    // var A = function () {
    //
    // }
    // A.prototype.n = 1
    // var b = new A()
    // var c = new A()
    // console.log(b.n, b.m, c.n, c.m);// 1 undefined 1 undefined


    // 2
    // var A = function() {
    // }
    // A.prototype.n = 1
    //
    // // 通过构造函数A,创建一个名字为b的实例,实例的隐式原型对象指向A.prototype--->xxxxx01
    // var b = new A()
    //
    // // 将A.prototype的值重置为对象
    // A.prototype = {
    //     n: 2,
    //     m: 3
    // }
    // var c = new A()
    // console.log(b.n, b.m, c.n, c.m);// 1 undefined, 2 3

    // 3
    var A = function() {
    }
    A.prototype.n = 1
    var b = new A();
    A.prototype = {};
    A.prototype.n = 100;
    A.prototype.m = 200;
    var c = new A();
    console.log(b.n, b.m, c.n, c.m);// 1 undefined 100 200
</script>
</html>